<html>
<head>
    <meta charset="UTF-8">
    <title>1</title>
</head>
<body>
    <script>
        
    var arr =new Array("John","Cena","Randy","sandy","Bobby");
    var arr1 = [1,"xiaoming",true];
    for (i=0 ; i<arr.length ; i++){
        document.write(arr[i]+"<br>");
    }
    document.write("<br>");
    document.write(arr);
    for (i=0 ; i<arr1.length ; i++){
        document.write(arr1[i]+"<br>");
    }
    document.write("<br>");
    arr1[1]="xiaohong";
    document.write(arr1);
    document.write("<br>");
    document.write(arr1[2],"<br>");
    //数组的增加
    document.write("<br>");
    arr.push("Zeo","Lisa");
    document.write(arr,"<br>");
    
    arr.unshift("Xiaohong","Liming");
    document.write(arr,"<br>");
    var arr2=["summer","winter"];
    var arr3=arr.concat(arr1,arr2);
    document.write(arr3,"<br>");
    //数组的删除 delete pop shift
    document.write("<br/>");
    document.write(arr3,"<br/>");
    delete arr3[1];
    document.write(arr3,"<br/>");
    var a=arr3.pop();
    document.write("pop删除数组最后一个元素是:",a,"<br/>");
    document.write(arr3,"<br/>");
    var b=arr3.shift();
    document.write("shift删除数组第一个元素是:",b,"<br/>");
    document.write(arr3,"<br/>");
    document.write("四、splice()方法用来对数组进行增删改操作<br/>");
    document.write("splice()方法有三个参数：<br/>");
    document.write("1.第一个参数：表示要操作的数组元素的下标<br/>");
    document.write("2.第二个参数：表示要删除的元素的个数<br/>");
    document.write("3.第三个参数：表示要添加的元素<br/>");
    document.write("splice()方法返回的是一个数组，该数组包含了被删除的元素<br/>");
    document.write("splice()方法会改变原数组<br/>");
    document.write("splice()方法的第一个参数如果是负数，则表示从数组的末尾开始计算<br/>");
    document.write("splice()方法的第二个参数如果是负数，则表示要删除的元素的个数<br/>");
    document.write("splice()方法的第三个参数如果是负数，则表示要添加的元素<br/>"); 
    document.write(arr3,"<br/>");
    arr3.splice(10);//从下标为10的元素开始删除，直到数组的末尾
    document.write(arr3,"<br/>");
    arr3.splice(6,2);//从下标为6的元素开始删除，删除2个元素
    document.write(arr3,"<br/>");
    arr3.splice(6,0,"summer","winter");//从下标为6的元素开始删除，删除0个元素，添加summer和winter
    document.write(arr3,"<br/>");
    document.write("五、slice()方法提取字符串或者数组的一部分<br/>");
    var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
    document.write(fruits,"<br/>");
    var citrus = fruits.slice(1,3);//提取下标为1和2的元素
    document.write(citrus,"<br/>");
    var dfruits = fruits.slice(-3,-1);//提取下标为-3和-2的元素
    document.write(dfruits,"<br/>");
    
    document.write("六、join()方法将数组转换为字符串<br/>");
    </script>
</body>
</html>